package org.dtrd.modules.content.articles.entity.bean;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.dtrd.modules.content.articles.entity.po.DtrdExtEmsCategory;

import java.util.List;

/**
 * 文章分类
 *
 * @author 萧
 * @date:2021-08-25 4:32 下午
 **/
@Data
@ApiModel(value = "文章分类", description = "文章分类信息名称+图片")
public class ArticleCategory {

    @ApiModelProperty(name = "分类ID", value = "分类ID")
    private Integer classId;

    @ApiModelProperty(name = "父分类ID")
    private Integer parentId;

    @ApiModelProperty(name = "分类名称")
    private String categoryName;

    @ApiModelProperty(name = "分类图标")
    private String categoryIcon;

    @ApiModelProperty(name = "文章数目")
    private Integer articleCount;

    /**
     * 供OMS前端使用，固定写死，勿做修改  萧  2022-05-16 15:07:16
     */
    private ScopedSlots scopedSlots = new ScopedSlots();

    private List<ArticleCategory> children;

    public ArticleCategory parseFromPO(DtrdExtEmsCategory po) {
        classId = po.getClassId();
        categoryName = po.getName();
        categoryIcon = po.getImage();
        return this;
    }

    private class ScopedSlots {
        private String title = "custom";

        public String getTitle() {
            return title;
        }

        public void setTitle(String title) {
            this.title = title;
        }
    }
}
